package cn.adelyn.base.auth.controller;

import cn.adelyn.base.auth.constant.UserType;
import cn.adelyn.base.auth.pojo.dto.RegisterAccountDTO;
import cn.adelyn.base.auth.service.AuthAccountService;
import cn.adelyn.common.core.response.ServerResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@RequestMapping("user")
public class AccountController {

    @Autowired
    AuthAccountService authAccountService;

    @PostMapping
    public ServerResponseEntity registerAccount(@RequestBody @Validated RegisterAccountDTO registerAccountDTO) {
        registerAccountDTO.setUserType(UserType.NORMAL_USER);
        return authAccountService.registerAccount(registerAccountDTO);
    }
}
